/* jshint esversion: 6 */
var MiddleWare = require("./MiddleWare");
var CronJob = require('cron').CronJob;
var MyRequest = MiddleWare.MyRequest;
var post = "post";
var get = "get";

//----------------post------------------
function d1() {
    MyRequest("/wxvacation/listPage", post)
        .then(res => {
            console.log(res);
        }, err => {
            console.error(err);
        });
}

function d2() {
    var param_data = {
        //base64解出来是你的体温数据
        "value": "eyJoZWFsdGhDb25kaXRpb24iOiLmraPluLgiLCJ0b2RheU1vcm5pbmdUZW1wZXJhdHVyZSI6IjM2wrBDfjM2LjXCsEMiLCJ5ZXN0ZXJkYXlFdmVuaW5nVGVtcGVyYXR1cmUiOiIzNsKwQ34zNi41wrBDIiwieWVzdGVyZGF5TWlkZGF5VGVtcGVyYXR1cmUiOiIzNsKwQ34zNi41wrBDIn0="
    };
    MyRequest("/wxvacation/monitorRegisterForReturned", post, param_data)
        .then(res => {
            console.log(res);
        }, err => {
            console.log(res);
        });
}

function d3() {
    MyRequest("/wxvacation/checkRegisterNew", get)
        .then(res => {
            console.log(res);
        }, err => {
            console.error(err);
        });
}

// d1(); //获取打卡记录
// d2(); //打卡脚本
// d3(); //获取是否登陆

new CronJob('00 00 00 * * *', function() { //每天0点自动打卡
    d2();
}, null, true);